/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "pyfntbpedviatic")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pyfntbpedviatic.findAll", query = "SELECT p FROM Pyfntbpedviatic p"),
    @NamedQuery(name = "Pyfntbpedviatic.findByPyfntbpedviaticid", query = "SELECT p FROM Pyfntbpedviatic p WHERE p.pyfntbpedviaticid = :pyfntbpedviaticid"),
    @NamedQuery(name = "Pyfntbpedviatic.findByObservaciones", query = "SELECT p FROM Pyfntbpedviatic p WHERE p.observaciones = :observaciones"),
    @NamedQuery(name = "Pyfntbpedviatic.findByFechaini", query = "SELECT p FROM Pyfntbpedviatic p WHERE p.fechaini = :fechaini"),
    @NamedQuery(name = "Pyfntbpedviatic.findByFechafin", query = "SELECT p FROM Pyfntbpedviatic p WHERE p.fechafin = :fechafin")})
public class Pyfntbpedviatic implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pyfntbpedviaticid")
    private Integer pyfntbpedviaticid;
    @Size(max = 255)
    @Column(name = "observaciones")
    private String observaciones;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fechaini")
    @Temporal(TemporalType.DATE)
    private Date fechaini;
    @Column(name = "fechafin")
    @Temporal(TemporalType.DATE)
    private Date fechafin;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyfntbpedviaticid")
    private Collection<Pyfntbpedvicom> pyfntbpedvicomCollection;
    @JoinColumn(name = "pyfntbreqviaticoid", referencedColumnName = "pyfntbreqviaticoid")
    @ManyToOne(optional = false)
    private Pyfntbreqviatico pyfntbreqviaticoid;
    @JoinColumn(name = "pyfntbcostviatid", referencedColumnName = "pyfntbcostviatid")
    @ManyToOne(optional = false)
    private Pyfntbcostviat pyfntbcostviatid;

    public Pyfntbpedviatic() {
    }

    public Pyfntbpedviatic(Integer pyfntbpedviaticid) {
        this.pyfntbpedviaticid = pyfntbpedviaticid;
    }

    public Pyfntbpedviatic(Integer pyfntbpedviaticid, Date fechaini) {
        this.pyfntbpedviaticid = pyfntbpedviaticid;
        this.fechaini = fechaini;
    }

    public Integer getPyfntbpedviaticid() {
        return pyfntbpedviaticid;
    }

    public void setPyfntbpedviaticid(Integer pyfntbpedviaticid) {
        this.pyfntbpedviaticid = pyfntbpedviaticid;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    public Date getFechaini() {
        return fechaini;
    }

    public void setFechaini(Date fechaini) {
        this.fechaini = fechaini;
    }

    public Date getFechafin() {
        return fechafin;
    }

    public void setFechafin(Date fechafin) {
        this.fechafin = fechafin;
    }

    @XmlTransient
    public Collection<Pyfntbpedvicom> getPyfntbpedvicomCollection() {
        return pyfntbpedvicomCollection;
    }

    public void setPyfntbpedvicomCollection(Collection<Pyfntbpedvicom> pyfntbpedvicomCollection) {
        this.pyfntbpedvicomCollection = pyfntbpedvicomCollection;
    }

    public Pyfntbreqviatico getPyfntbreqviaticoid() {
        return pyfntbreqviaticoid;
    }

    public void setPyfntbreqviaticoid(Pyfntbreqviatico pyfntbreqviaticoid) {
        this.pyfntbreqviaticoid = pyfntbreqviaticoid;
    }

    public Pyfntbcostviat getPyfntbcostviatid() {
        return pyfntbcostviatid;
    }

    public void setPyfntbcostviatid(Pyfntbcostviat pyfntbcostviatid) {
        this.pyfntbcostviatid = pyfntbcostviatid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pyfntbpedviaticid != null ? pyfntbpedviaticid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pyfntbpedviatic)) {
            return false;
        }
        Pyfntbpedviatic other = (Pyfntbpedviatic) object;
        if ((this.pyfntbpedviaticid == null && other.pyfntbpedviaticid != null) || (this.pyfntbpedviaticid != null && !this.pyfntbpedviaticid.equals(other.pyfntbpedviaticid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Pyfntbpedviatic[ pyfntbpedviaticid=" + pyfntbpedviaticid + " ]";
    }
    
}
